import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { LabelForm, LabelPage, LabelQuery } from "./types";

/**
 * 获取用户分页列表
 *
 * @param queryParams
 */
export function getLabelPage(
  queryParams: LabelQuery
): AxiosPromise<PageResult<LabelPage[]>> {
  return request({
    url: "/admin/memberLabel/index",
    method: "get",
    params: queryParams,
  });
}

/**
 * 获取用户表单详情
 *
 * @param ids
 */
export function getLabelForm(ids: number): AxiosPromise<LabelForm> {
  return request({
    url: "/admin/memberLabel/edit",
    method: "get",
    params: {
      ids: ids,
    },
  });
}

/**
 * 添加
 *
 * @param data
 */
export function addLabel(data: any) {
  return request({
    url: "/admin/memberLabel/add",
    method: "post",
    data: data,
  });
}

/**
 * 修改
 *
 * @param id
 * @param data
 */
export function updateLabel(data: LabelForm) {
  return request({
    url: "/admin/memberLabel/edit",
    method: "put",
    data: data,
  });
}

/**
 * 删除
 *
 * @param data
 */
export function deleteLabels(data: any) {
  return request({
    url: "/admin/memberLabel/del",
    method: "delete",
    data,
  });
}

